package com.atcd.sotoken.controller;

import com.atcd.sotoken.service.ChatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

/**
 * @version 1.0
 * @Author tw
 * @Date 2025/1/23 15:57
 * @注释
 */
@RestController
@RequestMapping("/get/")
@RefreshScope //自动刷新配置
public class ChatController {


    @Value("${myconfig.msg}")
    private String msg;


    @Autowired
    private ChatService chatService;

    @GetMapping("chat")
    public String chat(@RequestParam("ask") String ask) throws IOException {
        return   chatService.askDeepSeek(ask);
    }

    @GetMapping("test")
    public String test() {
        return  msg;
    }
}
